package com.cnebula.dataprocess.task.center.comsumer;

import org.apache.rocketmq.spring.starter.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.starter.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cnebula.dataprocess.common.hive.HiveDataPassJobResult;
import com.cnebula.dataprocess.task.center.scheduler.TaskScheduler;
import com.google.gson.Gson;

@Service
@RocketMQMessageListener(topic = "hive-datapass-job-topic", consumerGroup = "hive-datapass-job-group")
public class HiveDataPassJobConsumer implements RocketMQListener<HiveDataPassJobResult>{


	private static final Logger log = LoggerFactory.getLogger(HiveLoadDataJobConsumer.class);

	private Gson gson = new Gson();
	
	@Autowired
	TaskScheduler taskScheduler;

	@Override
	public void onMessage(HiveDataPassJobResult arg0) {
		log.info("=============================receive hive purge job message======================");
		log.info(gson.toJson(arg0));
		log.info("===================================================================================");
		
		taskScheduler.next(arg0);
	}

}
